import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';

@Injectable()
export class ConfigurationService {
  constructor(private configService: ConfigService) {}
  get mysqlHost() {
    return this.configService.get('MYSQL_HOST');
  }
  get mysqlPort() {
    return this.configService.get('MYSQL_PORT');
  }
  get mysqlDB() {
    return this.configService.get('MYSQL_DB');
  }
  get mysqlUser() {
    return this.configService.get('MYSQL_USER');
  }
  get mysqlPassword() {
    return this.configService.get('MYSQL_PASSWORD');
  }
  get mysqlConfig() {
    return {
      host: this.mysqlHost,
      port: this.mysqlPort,
      database: this.mysqlDB,
      username: this.mysqlUser,
      password: this.mysqlPassword,
    };
  }
  get smtpHost() {
    return this.configService.get('SMTP_HOST');
  }
  get smtpPort() {
    return this.configService.get('SMTP_PORT');
  }
  get smtpUser() {
    return this.configService.get('SMTP_USER');
  }
  get smtpPass() {
    return this.configService.get('SMTP_PASS');
  }
  get mongodbHost() {
    return this.configService.get('MONGO_HOST');
  }
  get mongodbPort() {
    return this.configService.get('MONGO_PORT');
  }
  get mongodbDB() {
    return this.configService.get('MONGO_DB');
  }
  get mongodbUser() {
    return this.configService.get('MONGO_USER');
  }
  get mongodbPassword() {
    return this.configService.get('MONGO_PASSWORD');
  }
  get mongodbConfig() {
    return {
      uri: `mongodb://${this.mongodbUser}:${this.mongodbPassword}@${this.mongodbHost}:${this.mongodbPort}/${this.mongodbDB}`,
    };
  }
}
